package controller

import (
	"github.com/gin-gonic/gin"
	"kamibako.ltd/go-essential/internal/service"
	"strconv"
)

var User = cUser{}

type cUser struct {

}

func (a *cUser) Register(c *gin.Context) {
	name := c.PostForm("name")
	password := c.PostForm("password")
	telephone := c.PostForm("telephone")
	service.User.Register(c, name, password, telephone)
}

func (a *cUser) GetUserById(c *gin.Context) {
	id, err := strconv.Atoi( c.Param("id"))
	service.User.GetUserById(c, id)
	if err != nil {
		panic(err)
	}
}